package com.lx.user.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lx.bilibili.entity.UserEx;
import com.lx.bilibili.entity.Video;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lx
 * @since 2025-03-26
 */
public interface UserExMapper extends BaseMapper<UserEx> {

    @Select("SELECT\n" +
            "	COUNT(*) \n" +
            "FROM\n" +
            "	`user` a,\n" +
            "	video b \n" +
            "WHERE\n" +
            "	a.id = b.uid \n" +
            "	AND a.id = #{id}")

    Integer getVideoNumById(int id);

    @Select("SELECT\n" +
            "	* \n" +
            "FROM\n" +
            "	`user` a,\n" +
            "	video b \n" +
            "WHERE\n" +
            "	a.id = b.uid \n" +
            "	AND a.id = #{id} \n" +
            "ORDER BY\n" +
            "	b.id DESC \n" +
            "	LIMIT 0,6")

    List<Video> getVideoById(int id);
}
